import {
	request,
	baseUrl
} from "../../request.js"

//域名 端口号
//var baseUrl = 'https://wzxlovemzy.com:6001/user'


/**
 * 1，修改用户信息
 * @param {*} reqData 请求参数
 */
export function updateUserInfo(reqData) {
	return request({
		url: baseUrl + '/user/updateUserInfo',
		method: 'POST',
		data: {
			userId: reqData.userId || uni.getStorageSync('userId'),
			username: reqData.username || '',
			phone: reqData.phone || '',
			gender: reqData.gender || '',
			address: reqData.address || '',
			head: reqData.head || '',
			nickname: reqData.nickname || '',
			birthday: reqData.birthday || ''
		}
	})
}

/**
 * 2，查询用户
 * @param {Object} userId
 * @param {Object} searchName
 */
export function searchByCondition(userId, searchName) {
	return request({
		url: baseUrl + '/search/searchByCondition',
		method: 'POST',
		data: {
			userId: userId || uni.getStorageSync('userId'),
			searchName: searchName
		}
	})
}

/**
 * 3，查询用户信息
 * @param {Object} userId
 */
export function getUserInfo(userId) {
	return request({
		url: baseUrl + '/user/getUserInfo?userId=' + userId,
		method: 'Get'
	})
}
